package com.selfdriving.activity;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.selfdriving.BaseFragmentActivity;
import com.selfdriving.R;
import com.selfdriving.adapter.NearFriendsAdapter;
import com.selfdriving.view.MoMoRefreshListView;
import com.selfdriving.wl.activity.AddMyFriendsManage;

public class ActivityMyFriends extends BaseFragmentActivity implements
		OnClickListener
{
	private MoMoRefreshListView listView;
	private NearFriendsAdapter adapter;
	private TextView title;
	private ImageButton imgBreak;
	Button addFriends;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		super.setContentView(R.layout.refresh_listview_have_word);
		initViews();
		initEvents();
	}

	@Override
	protected void initViews()
	{
		listView = (MoMoRefreshListView) findViewById(R.id.refresh_list);
		adapter = new NearFriendsAdapter(mApplication, this,
				mApplication.nearFriendsList);
		addFriends = (Button) findViewById(R.id.top_right_but);
		title = (TextView) super.findViewById(R.id.top_text_middle);
		imgBreak = (ImageButton) super.findViewById(R.id.head_break);
		imgBreak.setVisibility(View.VISIBLE);
		addFriends.setVisibility(View.VISIBLE);
		addFriends.setText("添加");
		listView.setAdapter(adapter);
		title.setText("我的好友");
	}

	@Override
	protected void initEvents()
	{
		addFriends.setOnClickListener(this);
		imgBreak.setOnClickListener(this);
	}

	@Override
	public void onClick(View v)
	{
		switch (v.getId())
		{
		case R.id.top_right_but:
			startActivity(AddMyFriendsManage.class);
			break;
		case R.id.head_break:
			finish();
			break;
		}
	}

}
